<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf8">
    <title> MVVM </title>
</head>
<body>
<script src="https://cdn.bootcss.com/vue/2.5.17-beta.0/vue.js"></script>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<div id="msg">
    {{b.c}}这是普通文本 {{b.c+1+message}}这是普通文本
    <p>{{message}}</p>
    <p><button type="button" v-on:click="clickBtn(message)">{{btnText}}</button></p>
</div>
<script>
    var vm = new Vue({
        el: "#msg",
        data:{
            b:{
                c:123
            },
            message: "hello world",
            btnText: "click me1"
        },

        mounted:function () {
            $.ajax({
                type:'get',
                url:'service/test.php',
                dataType:'text',
                success:function (ret) {
                    console.log(ret);
                    vm.message = ret;
                }
            })
        },

        methods:{
            clickBtn:function(message) {
                vm.btnText = "xxxxx";
                vm.message = "clicked" + message;
            }
        }
    });
</script>
</body>
</html>